newEntity{
	define_as = "ELEMENTAL",
	type = "elemental", subtype = "elemental",
	display = "E", color=colors.PURPLE,
	shader = "chaos_hue",
	name = "chaos elemental",
	desc = "Ever strange, ever shifting, this morphing elemental looks upon you with scorn and hate.",
	level_range = {1, 50}, exp_worth = 1,
	rarity = 1,
	rank = 1,
	max_life = resolvers.rngavg(9,11),
	stats = { str=17, dex=17, con=17 },
	ai = "dumb_talented_simple", ai_state = { talent_in=3, },
	combat = { dam=2, atk=10, apr=2, damtype=DamageType.CHAOS },
	combat_armor = 0, combat_defense = 0,
	resists = { [DamageType.MANA] = -75, },
	faction = "chaos",
}

newEntity{
	define_as = "ELEMENTAL_BOSS",
	type = "elemental", subtype = "elemental",
	display = "E", color=colors.BLUE,
	shader = "chaos_hue",
	name = "Qloif, Being of Chaos",
	desc = "Strange, distorted, and disheveled, this being glares at you with hatred from its shapless mass, indeed, it looks almost human.",
	level_range = {20, 50}, exp_worth = 1,
	rank = 5,
	body = { INVEN = 100, BODY = 1, CLOAK = 1, HEAD = 1, BELT = 1, HANDS = 1, FEET = 1 },
	max_life = resolvers.rngavg(150,180),
	stats = { str=25, dex=25, con=25 },
	ai = "dumb_talented_simple", ai_state = { talent_in=3, },
	combat = { dam=18, atk=10, apr=2, damtype=DamageType.CHAOS },
	combat_armor = 0, combat_defense = 0,
	resists = { [DamageType.MANA] = -100, },
	faction = "chaos",
	resolvers.equip{{type="armor", subtype="waist", defined="ELEMENTAL_ARTIFACT", autoreq=true},},
	on_die = function(self, who)
--		game.player:resolveSource():
		if game.player.faction ~= "chaos" then game.player:setQuestStatus("destroy-chaos", engine.Quest.COMPLETED, "chaos-guardian") end
		game:setAllowedBuild("player_chaos")
--		local D = require "engine.Dialog"
--		D:simplePopup("Winner!", "#VIOLET#Congratulations, you have won the game! At least for now... The quest has only started!")
	end,

--	if game.player.name == "Chaos Elemental" then can_speak = "boss-chaos" end
}
